<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8"
         contentType="text/html;charset=utf-8" %>
<%@ include file="/common/taglibs.jsp" %>
<head>
    <title>博文列表</title>
</head>
<body>
<div id="wrapper">
    <c:set var="left">blog</c:set>
    <%@ include file="/include/left/operation.jsp" %>

    <s:action name="blog!search" var="blogList" executeResult="false">
        <s:param name="query.enabled">true</s:param>
        <s:param name="query.order">addTime</s:param>
        <s:param name="query.desc">true</s:param>
        <s:param name="query.pagesize">10</s:param>
        <c:if test="${param.startAddTime!=null && param.startAddTime!=''}">
            <s:param name="query.startAddTime">${param.startAddTime} 00:00:00</s:param>
        </c:if>
        <c:if test="${param.endAddTime!=null && param.endAddTime!=''}">
            <s:param name="query.endAddTime">${param.endAddTime} 23:59:59</s:param>
        </c:if>
    </s:action>

    <div id="page-wrapper" class="gray-bg">

        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>博文列表</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="${ctx}/blog/">运营管理</a>
                    </li>
                    <li>
                        <a>博文管理</a>
                    </li>
                    <li class="active">
                        <strong>博文列表</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2 m-add-new">
                <a href="${ctx}/blog/add" class="btn btn-info"><i class="glyphicon glyphicon-plus"></i> 添加</a>
            </div>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight ecommerce">
            <form action="${ctx}/blog/" method="get" class="shaix">
                <div class="ibox-content m-b-sm border-bottom">
                    <div class="row">
                        <div class="col-sm-4">
                            <div class="form-group">
                                <label class="control-label" for="title">博文标题</label>
                                <input type="text" id="title" name="query.title" value="${query.title}"
                                       placeholder="请输入博文标题"
                                       class="form-control">
                            </div>
                        </div>
                        <%--<div class="col-sm-2">--%>
                            <%--<div class="form-group">--%>
                                <%--<label class="control-label" for="source">来源</label>--%>
                                <%--<input type="text" id="source" name="query.source" value="${query.source}"--%>
                                       <%--placeholder="请输入博文来源"--%>
                                       <%--class="form-control">--%>
                            <%--</div>--%>
                        <%--</div>--%>


                        <div class="col-sm-2">
                            <div class="form-group">
                                <label class="control-label" for="select">自定义时间</label>
                                <select id="select" class="form-control" name="timeType">
                                    <option value="3">自定义时间</option>
                                    <option value="0" <c:if test="${param.timeType==0}">selected</c:if>>今天</option>
                                    <option value="1" <c:if test="${param.timeType==1}">selected</c:if>>最近一周</option>
                                    <option value="2" <c:if test="${param.timeType==2}">selected</c:if>>最近一个月</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <div class="form-group">
                                <label class="control-label" for="date_before">开始时间</label>
                                <input type="text" id="date_before" name="startAddTime" class="form-control"
                                       placeholder="开始时间" value="${param.startAddTime}">
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <div class="form-group">
                                <label class="control-label" for="date_after">结束时间</label>
                                <input type="text" id="date_after" name="endAddTime" class="form-control"
                                       placeholder="结束时间" value="${param.startAddTime}">
                            </div>
                        </div>

                        <%--<div class="col-sm-4">--%>
                        <%--<div class="form-group">--%>
                        <%--<label class="control-label" for="status">Status</label>--%>
                        <%--<select name="status" id="status" class="form-control">--%>
                        <%--<option value="1" selected="">Enabled</option>--%>
                        <%--<option value="0">Disabled</option>--%>
                        <%--</select>--%>
                        <%--</div>--%>
                        <%--</div>--%>
                        <div class="col-sm-12">
                            <input type="submit" class="btn btn-sm btn-primary" value="查询"/>
                        </div>
                    </div>

                </div>
            </form>


            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox">
                        <div class="ibox-content">

                            <table class="footable table table-striped table-hover toggle-arrow-tiny default breakpoint footable-loaded"
                                   data-page-size="15">
                                <thead>
                                <tr>

                                    <th data-toggle="true" class="footable-visible footable-first-column footable-sortable">添加时间<span class="footable-sort-indicator"></span></th>
                                    <th data-hide="phone" class="footable-visible footable-sortable">博文标题<span class="footable-sort-indicator"></span></th>
                                    <th data-hide="all" class="footable-sortable">分类<span class="footable-sort-indicator"></span></th>
                                    <th data-hide="all" class="footable-sortable">风格<span class="footable-sort-indicator"></span></th>
                                    <th data-hide="all" class="footable-sortable">颜色<span class="footable-sort-indicator"></span></th>
                                    <th data-hide="all" class="footable-sortable">浏览次数<span class="footable-sort-indicator"></span></th>
                                    <th data-hide="all" class="footable-sortable">所属商品<span class="footable-sort-indicator"></span></th>
                                    <th class="text-right footable-visible footable-last-column" data-sort-ignore="true">操作</th>

                                </tr>
                                </thead>
                                <tbody>

                                <s:iterator value="%{#blogList.blogs}" status="rowStatus" var="blog">
                                    <tr class="footable-even" style="">
                                        <td class="footable-visible">
                                            <s:date name="%{addTime}" format="yyyy-MM-dd HH:mm"></s:date>
                                        </td>
                                        <td data-toggle="tooltip" data-placement="bottom"
                                            class="footable-visible footable-first-column">
                                            <span data-toggle="tooltip" data-placement="top"
                                                  title="${title}"> ${util:preview(title,true,10)} </span>
                                        </td>

                                        <td class="footable-visible">${category}</td>
                                        <td class="footable-visible">${style}</td>
                                        <td class="footable-visible">${color}</td>
                                        <td class="footable-visible">${count}</td>
                                        <td class="footable-visible">${product.name}</td>
                                            <%--<td class="footable-visible">--%>
                                            <%--<span class="label label-primary">Enable</span>--%>
                                            <%--&lt;%&ndash;<span class="label label-warning">Enable</span>&ndash;%&gt;--%>
                                            <%--&lt;%&ndash;<span class="label label-danger">Disabled</span>&ndash;%&gt;--%>
                                            <%--</td>--%>
                                        <td class="text-right footable-visible footable-last-column">
                                            <div class="btn-group">
                                                <button class="btn-info btn btn-xs" onclick="window.location='${ctx}/blog/edit/${id}'">编辑</button>
                                                <button class="btn-danger btn btn-xs" onclick="deleteData('确定要删除吗','blog','${id}','${ctx}');">删除</button>
                                            </div>
                                        </td>
                                    </tr>

                                </s:iterator>
                                </tbody>


                            </table>
                            <c:set var="href">timeType=${param.timeType}&startAddTime=${param.startAddTime}&endAddTime=${param.endAddTime}&</c:set>
                            <%@ include file="/common/page.jsp" %>
                        </div>
                    </div>
                </div>
            </div>

        </div>

        <%@ include file="/common/footer.jsp" %>

    </div>

</div>

<%@ include file="/common/scripts.jsp" %>
<%@ include file="/common/script/cxcalendar.jsp" %>



</body>

